Living body detection method based on facial recognition, and electronic device and storage medium

ABSTRACT

Method, an electronic device and a storage medium for living body detection based on face recognition are disclosed. The method comprises: obtaining to-be-detected infrared image and visible light image; performing edge detection and texture feature extraction on the infrared image, and feature extraction on the visible light image through a convolutional neural network; and determining whether the infrared and visible light images pass living body detection based on results of the edge detection and texture feature extraction on the to-be-detected infrared image, and a result of feature extraction on the to-be-detected visible light image through the convolutional neural network. The method, an electronic device and a storage medium for living body detection based on face recognition combine the advantages of three technologies of edge detection, texture feature extraction and convolution neural network, effectively perform living body detection, and improve the determination accuracy.

The present application claims the priority to a Chinese patentapplication No. 201910072693.8, filed with the China NationalIntellectual Property Administration on Jan. 25, 2019 and entitled“Method, electronic device and storage medium for living body detectionbased on face recognition”, which is incorporated herein by reference inits entirety.

TECHNICAL FIELD

The present application relates to the field of face recognitiontechnologies, and in particular, to a method, an electronic device, anda storage medium for living body detection based on face recognition.

BACKGROUND

With the rapid development of the Artificial Intelligence (AI) industry,biometric identification has been applied in the security industry. Forexample, the above-mentioned biometric recognition includes facerecognition, fingerprint recognition and iris recognition, etc.

Taking face recognition as an example, the face recognition technologyis more and more mature, the recognition accuracy rate of facerecognition in a specific scene is up to more than 95%, and even thefaces of twins can be directly distinguished sometimes. However, as theincreasing accuracy of face recognition, faces in photos and videos inreal scenes may be mistaken as real faces, which bring an opportunityfor criminals and huge losses or unnecessary troubles to legitimateusers.

Currently, the main attack methods faced by face recognition include:(1) a photo attack method that prints a high-definition and realisticphoto, dig out an important region of the face, and replace a real facewith the dug important region of the face, wherein the photo includes ablack-and-white photo and a color-printed photo, and the importantregion of the face can be the region where a nose, eyes, a mouth, etc.are positioned; (2) a video attack method that obtains a pre-recordedreal face video and replaces the real face with the face in the video,wherein the video can be a real face video obtained from a socialnetwork site or a real face video recorded by a camera in a publicplace; (3) a model attack method that creates a realistic face model bya high-precision three Dimensional (3D) printer and replace the realface with the above-mentioned face model. Therefore, there is a need toprovide a new technical solution capable of further performing theliving body detection based on the results of face recognition.

The information disclosed in this background section is only forenhancement of understanding of the overall background of the presentinvention and should not be taken as an acknowledgement or any form ofsuggestion that this information is already known in the prior art tothose skilled in the art.

SUMMARY

An object of the embodiments of the present application is to provide amethod, an electronic device, and a storage medium for living bodydetection based on face recognition to enable living body detection.

To solve the above technical problem, the embodiments of the presentapplication are implemented through the following aspects.

In a first aspect, the embodiments of the present application provide amethod for living body detection based on face recognition, including:obtaining a to-be-detected infrared image and a to-be-detected visiblelight image respectively; performing edge detection and texture featureextraction on the to-be-detected infrared image; performing featureextraction on the to-be-detected visible light image through aconvolutional neural network; and determining whether the to-be-detectedinfrared image and the to-be-detected visible light image pass livingbody detection based on a result of the edge detection on theto-be-detected infrared image, a result of the texture featureextraction on the to-be-detected infrared image, and a result of thefeature extraction on the to-be-detected visible light image through theconvolutional neural network.

In a second aspect, the embodiments of the present application providean apparatus for living body detection based on face recognition,including: an obtaining module configured for a to-be-detected infraredimage and a to-be-detected visible light image respectively; aprocessing module configured for performing edge detection and texturefeature extraction on the to-be-detected infrared image, and performingfeature extraction on the to-be-detected visible light image through aconvolutional neural network; and a determining module configured fordetermining whether the to-be-detected infrared image and theto-be-detected visible light image pass living body detection based on aresult of the edge detection on the to-be-detected infrared image, aresult of the texture feature extraction on the to-be-detected infraredimage, and a result of the feature extraction on the to-be-detectedvisible light image through the convolutional neural network.

In a third aspect, the embodiments of the present application provide anelectronic device, including: a processor and a memory having computerexecutable instructions stored thereon that, when executed by theprocessor, cause the processor to implement the steps of the methodaccording to the first aspect as described above.

In a fourth aspect, the embodiments of the present application provide acomputer-readable storage medium for storing computer-executableinstructions that, when executed by a processor, cause the processor toimplement the steps of the method according to the first aspectdescribed above.

In a fifth aspect, the embodiments of the present application provide asystem for living body detection based on face recognition, including:an image acquisition device for acquiring infrared images and visiblelight images; an electronic device, comprising: a processor; and amemory configured to store computer executable instructions that, whenexecuted, cause the processor to perform the following operations:obtaining infrared images and visible light images acquired by the imageacquisition component, and selecting a to-be-detected infrared image anda to-be-detected visible light image; performing edge detection andtexture feature extraction on the to-be-detected infrared image;performing feature extraction on the to-be-detected visible light imagethrough a convolutional neural network; and determining whether theto-be-detected infrared image and the to-be-detected visible light imagepass living body detection based on a result of the edge detection onthe to-be-detected infrared image, a result of the texture featureextraction on the to-be-detected infrared image, and a result of thefeature extraction on the to-be-detected visible light image through theconvolutional neural network.

When the solution provided in this embodiment is applied to living bodydetection, the to-be-detected infrared image and the to-be-detectedvisible light image can be respectively obtained, edge detection andtexture feature extraction are performed on the to-be-detected infraredimage, and feature extraction is performed on the to-be-detected visiblelight image through a convolutional neural network, and whether theto-be-detected infrared image and the to-be-detected visible light imagepass living body detection is determined based on the result of edgedetection on the to-be-detected infrared image, the result of the abovetexture feature extraction and the result of feature extraction on theto-be-detected visible light image through the convolutional neuralnetwork. The process can combine the advantages of three technologies ofedge detection, texture feature extraction and convolution neuralnetwork, and can effectively perform living body detection. In the casethat the to-be-detected infrared image and the to-be-detected visiblelight image include the image region of a face, it can be efficientlydetermined whether the face in the image belongs to the face of a livingbody, so as to improve the determination accuracy.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to illustrate the embodiments of the present application andthe technical solutions of the prior art more clearly, the followingbriefly describes the embodiments and the drawings needed in the priorart. Obviously, the drawings in the following description are only someembodiments of the present application, and it is obvious for thoseskilled in the art that other drawings can be obtained according to thedrawings without creative efforts.

FIG. 1 is a schematic flowchart illustrating a method for living bodydetection based on face recognition according to an embodiment of thepresent application;

FIG. 2 is another schematic flowchart illustrating a method for livingbody detection based on face recognition according to an embodiment ofthe present application;

FIG. 3 is another schematic flowchart illustrating a method for livingbody detection based on face recognition according to an embodiment ofthe present application;

FIG. 4 is a schematic structural diagram of an apparatus for living bodydetection based on face recognition according to an embodiment of thepresent application;

FIG. 5 is another schematic structural diagram of an apparatus forliving body detection based on face recognition according to anembodiment of the present application; and

FIG. 6 is a schematic diagram of a hardware structure of an electronicdevice for executing the method for living body detection based on facerecognition according to an embodiment of the present application.

DETAILED DESCRIPTION

In order to make the objects, technical solutions and advantages of thepresent application more clear, the following further describes thepresent application in detail with reference to the accompanyingdrawings and embodiments. Obviously, the described embodiments are onlya part of the embodiments of the present application, rather than allthe embodiments. Based on the embodiments in the present application,all other embodiments obtained by those skilled in the art withoutcreative work shall fall within the protection scope of the presentapplication.

FIG. 1 illustrates a schematic flowchart of a method for living bodydetection based on face recognition according to an embodiment of thepresent application. The method may be performed by an electronicdevice, for example, the above electronic device may be a terminaldevice or a server device. In other words, the above method may beperformed by software or hardware installed on a terminal device or aserver device. The above server device includes but is not limited to: asingle server, a server cluster, a cloud server or a cloud servercluster, etc. As shown in FIG. 1, the method includes the followingsteps S10-S40.

S10: obtaining a to-be-detected infrared image and a to-be-detectedvisible light image respectively.

In an embodiment of the present application, the above to-be-detectedinfrared image and the to-be-detected visible light image may be: aninfrared image a the visible light image respectively acquired by animage acquisition component for the same scene.

Specifically, the above to-be-detected infrared image and theto-be-detected visible light image may include image regions of the sameface. In addition, the above to-be-detected infrared image may includeimage regions of a plurality of faces, and the above to-be-detectedvisible light image also includes the above image regions of theplurality of faces.

The above scene may be a scene where an access control device ispositioned. The above image acquisition component may be a componentthat can acquire not only infrared images but also visible light images,such as a binocular camera, etc.

In another embodiment of the present application, the aboveto-be-detected infrared image and the to-be-detected visible light imagemay be images acquired by the image acquisition component at the samemoment, and thus have the same time stamp.

In addition, the above image acquisition component can also acquire aplurality of infrared images and a plurality of visible light images,and then select the infrared image and the visible light image thatcontains an image region of the same face from the above plurality ofinfrared images and the plurality of visible light images as theto-be-detected infrared image and the to-be-detected visible light imagerespectively.

S20: performing edge detection and texture feature extraction on theto-be-detected infrared image.

In image processing and computer vision, edge detection can be performedon an image to detect edge information in the image. For example, edgedetection is performed on an image to detect pixel points with obviousbrightness change in the image.

The texture feature is a visual feature that reflects homogeneity in animage. One of the attacks faced by face recognition is a tabletelectronic product attack, in which, the tablet electronic productpretends to be a real face by way of displaying a non-real face in aphoto or playing a non-real face in a video. Due to the fact that thetablet electronic product is interfered by high frequency, a largenumber of moire can be generated when a photo or a video is displayed,and the features of an image presented by the tablet electronic productare changed. In this case, when the face recognition is performed, it ispossible to determine whether there is moire in the image by analyzingthe image features, and then whether a real face or an unreal faceappears in the image can be quickly distinguished.

In one embodiment of the present application, the corresponding texturefeature may be extracted through an internal relationship betweenimaging pixels in an to-be-detected infrared image.

S30: performing feature extraction on the to-be-detected visible lightimage through a convolutional neural network.

The convolutional neural network is a network model which is often usedin deep learning. The network model has a multilayer structure, eachlayer performs feature extraction on input data of the layer, andextracted features are continuously input into the next layer in theform of a two-dimensional image.

S40: determining whether the to-be-detected infrared image and theto-be-detected visible light image pass living body detection based on aresult of the edge detection on the to-be-detected infrared image, aresult of the texture feature extraction on the to-be-detected infraredimage, and a result of the feature extraction on the to-be-detectedvisible light image through the convolutional neural network.

For ease of description, the result of edge detection on theto-be-detected infrared image may be referred to as a first result, theresult of texture feature extraction may be referred to as a secondresult, and the result of feature extraction on the to-be-detectedvisible light image through the convolutional neural network may bereferred to as a third result.

In an embodiment of the present application, since the first result, thesecond result, and the third result are all features of an image,feature fusion may be performed on the first result, the second result,and the third result, and then it is determined whether theto-be-detected infrared image and the to-be-detected visible light imagepass the living body detection based on a result of the feature fusion.

For example, a weighted calculation may be performed on the firstresult, the second result, and the third result, and the result of theweighted calculation may be used as the result of the feature fusion.

In another embodiment of the present application, it may also bedetermined whether the to-be-detected infrared image and theto-be-detected visible light image pass living body detection based onthe first result, the second result, and the third result, respectively,and then the number of determination results is counted, and a resultwith the highest number of statistics is taken as a final determinationresult.

For example, it is determined that the to-be-detected infrared image andthe to-be-detected visible light image pass the living body detectionbased on the first result; it is determined that the to-be-detectedinfrared image and the to-be-detected visible light image do not passliving body detection based on the second result; and it is determinedthat the to-be-detected infrared image and the to-be-detected visiblelight image pass the living body detection based on the third result.According to statistics, the number of results indicating passing theliving body detection is 2, and the number of results indicating notpassing the living body detection is 1, the final determination resultis: the to-be-detected infrared image and the to-be-detected visiblelight image do not pass the living body detection.

When the to-be-detected infrared image and the to-be-detected visiblelight image include image regions of the same face, the fact that theto-be-detected infrared image and the to-be-detected visible light imagepass living body detection means: the to-be-detected infrared image andthe to-be-detected visible light image are images acquired for a realface; the fact that the to-be-detected infrared image and theto-be-detected visible light image do not pass living body detectionmeans: the to-be-detected infrared image and the to-be-detected visiblelight image are images acquired for a non-real face, for example, imagescaptured from a photo, or a video.

Therefore, in the solution for the living body detection based on facerecognition provided in this embodiment, to-be-detected infrared imageand to-be-detected visible light image are obtained, edge detection andtexture feature extraction are performed on the to-be-detected infraredimage, and feature extraction is performed on the to-be-detected visiblelight image through a convolutional neural network, and whether theto-be-detected infrared image and the to-be-detected visible light imagepass the living body detection is determined based on the result of theedge detection on the to-be-detected infrared image, the result of theabove texture feature extraction and the result of the featureextraction on the to-be-detected visible light image through theconvolutional neural network. The process can combine the advantages ofthree technologies of edge detection, texture feature extraction andconvolution neural network, which can effectively perform living bodydetection. In the case that the to-be-detected infrared image and theto-be-detected visible light image include the image regions of a face,it can be efficiently determined whether the face in the image belongsto the face of living body, so as to improve the determination accuracy.

In an embodiment of the present application, before the to-be-detectedinfrared image and the to-be-detected visible light image are obtainedin S10, the image acquisition component may be further used to acquireinfrared images and visible light images, and then faces are positionedin the infrared images and the visible light images respectively througha face detection algorithm.

In this case, when the to-be-detected infrared image and theto-be-detected visible light image are obtained in S10, theto-be-detected infrared image and the to-be-detected visible light imagecan be respectively obtained from the infrared images and the visiblelight images according to the result of face positioning in the infraredimages and visible light images.

Specifically, the image acquisition component may acquire infraredimages according to a preset infrared image acquisition frequency, andacquire visible light images according to a preset visible light imageacquisition frequency. The infrared image acquisition frequency and thevisible light image acquisition frequency may be the same or different,which is not limited in the embodiments of the present application.

In an embodiment of the present application, when faces are respectivelypositioned in infrared images and visible light images through a facedetection algorithm, face regions in the infrared images and the visiblelight images may be detected, that is, face positioning is performed inthe infrared images and the visible light images, through the facedetection algorithm. In addition, after the face regions are detected,positions of face feature points in infrared images and positions offace feature points in visible light images can be determined on thebasis of the detected face regions.

In view of the above case, when faces are respectively positioned in theinfrared images and the visible light images by the face detectionalgorithm, the obtained results of face positioning may includeinformation of regions of faces in images and positions of face featurepoints.

When the region of the face in an image is a rectangular region, theabove information of the region may be coordinates of two diagonalvertices of the rectangular region. The above positions of face featurepoints can include positions of feature points for describing thecontour of the face in the image, positions of feature points fordescribing the eyes of a human in the image, positions of the featurepoints for describing the mouth of the human in the image.

Specifically, the infrared image and the visible light image thatinclude image regions of the same face can be selected, according to theresult of positioning a face, from the infrared images and the visiblelight images as the to-be-detected infrared image and the to-be-detectedvisible light image, respectively.

In an embodiment of the application, the infrared image and the visiblelight image, in which the information of the face in the region of imageis matched and the positions of the face feature points are matched, canbe determined as the to-be-detected infrared image and theto-be-detected visible light image.

For example, when the region overlap ratio is greater than a firstpreset threshold, it can be considered that the information of theregions is matched. In addition, in the case where the face featurepoints include feature points for representing the human eyes, theinterpupillary distance of the human eyes may be calculated frompositions of the face feature points, and then when the proportion ofinterpupillary distances is greater than a second preset threshold, itcan be considered that the positions of the face feature points arematched.

In another embodiment of the application, deflection angles andinterpupillary distances of faces in infrared images can be obtainedaccording to positions of face feature points in the infrared images,and deflection angles and interpupillary distances of the faces in thevisible light images can be obtained according to the positions of theface feature points in the visible light images; and the to-be-detectedinfrared image and the to-be-detected visible light image are selectedfrom the infrared images and the visible light images according toobtained deflection angles and interpupillary distances.

Specifically, postures of faces can be represented by deflection anglesand interpupillary distances thereof. When the posture of a facerepresented by the deflection angle and the interpupillary distance ofthe face in an infrared image is consistent with the posture of a facerepresented by the deflection angle and the interpupillary distancethereof in the visible light image, it can be considered that theinfrared image and the visible light image include the image regions ofthe same face, and can be respectively used as the to-be-detectedinfrared image and the to-be-detected visible light image.

For example, postures of faces can be considered to be consistent whenthe angle difference between the deflection angles is smaller than apreset difference value and the ratio between the interpupillarydistances is greater than a third preset threshold value.

The living body detection method provided in the embodiment of thepresent application will be described in detail with reference to thespecific embodiment shown in FIG. 2.

FIG. 2 shows another schematic flowchart of a method for living bodydetection based on face recognition according to the embodiments of thepresent application. The method may be performed by an electronicdevice, for example, a terminal device or a server device. In otherwords, the above method may be performed by software or hardwareinstalled in a terminal device or a server device. The above serverdevice includes but is not limited to: a single server, a servercluster, a cloud server or a cloud server cluster, etc. As shown in FIG.2, the method includes the following steps S11-S40.

S11: acquiring infrared images and visible light images using an imageacquisition component, and respectively positioning faces in theinfrared images and the visible light images through a face detectionalgorithm.

In one possible implementation, the image acquisition component mayinclude a binocular camera.

In one embodiment of the present application, the method includes:detecting face regions in infrared images and visible light imagesthrough a face detection algorithm. In addition, after the above faceregions are detected, the number of infrared faces and the positions offace feature points in the infrared images can be determined, and thenumber of visible light faces and the positions of the face featurepoints in the visible light images can be determined, on the basis ofthe detected face region. The above process realizes the positioning offaces in the infrared images and the visible light images respectively.

The above infrared face refers to an image region in the infrared imagewhere a face is positioned. The visible light face refers to an imageregion in the visible light image where a face is positioned.

Specifically, it can be roughly determined whether the infrared imagesand the visible light images contain image regions of the same facethrough the number of infrared faces in the infrared images and thenumber of visible light faces in the visible light images.

If the number of the infrared faces is different from that of thevisible light faces, the probability that the infrared image and thevisible light image contain the image region of the same face is low, onthe contrary, if the number of the infrared faces is the same as that ofthe visible light faces, the probability that the infrared image and thevisible light image contain the image region of the same face is high.

S12: obtaining deflection angles and interpupillary distances of facesaccording to positions of face feature points in infrared images andpositions of face feature points in visible images.

Specifically, in this step, deflection angles and interpupillarydistances of faces in infrared images are obtained according topositions of face feature points in the infrared images, and deflectionangles and interpupillary distances of faces in visible light images areobtained according to positions of face feature points in visible lightimages.

In one embodiment of the present application, the distance between twoeyes of a human can be calculated according to positions of featurepoints related to the human eyes, and then the interpupillary distanceof the face can be determined according to the above distance.

S13: selecting, according to obtained deflection angles andinterpupillary distances, a to-be-detected infrared image and ato-be-detected visible light image from infrared images and visiblelight images acquired by the image acquisition component.

The deflection angle and interpupillary distance of a face can reflectthe posture of the face. In application scenes such as face recognitionand face detection, images of a human face facing an image acquisitioncomponent may be acquired with high quality, and thus produce betterresults in face recognition and detection. Therefore, after the imageacquisition component acquires infrared images and visible light images,the above infrared images and visible light images can be filteredaccording to deflection angles and interpupillary distances, and imagesof faces facing away from the image acquisition component are filtered.For example, infrared images and visible light images with deflectionangles larger than a preset angle and interpupillary distances smallerthan a preset distance are filtered out.

Therefore, face images with poor quality in the infrared images and thevisible light images acquired by the image acquisition component can befiltered out according to the two parameters, i.e., deflection anglesand interpupillary distances, so as to improve the robustness of theliving body detection.

In an embodiment of the application, the image quality can be detectedaccording to an average brightness value of pixel points in the image.Specifically, the average brightness value of pixel points can becalculated for each infrared image acquired by the image acquisitioncomponent, and the average brightness values of pixel points can becalculated for each visible light image acquired by the imageacquisition component. When the average brightness value is smaller thana first preset brightness value, the image is dark and the image qualityis poor, and when the average brightness value is larger than a secondpreset brightness value, the image is over-bright and possiblyover-exposed and the image quality is poor. Therefore, images with poorquality in the infrared images and the visible light images can befiltered out in this way.

The first preset brightness value and the second preset brightness valuemay be set according to a specific application scene, which is notlimited in the embodiments of the present application.

In addition, when filtering out images with poor quality in the infraredimages and the visible light images, it can also be realized bycombining one or more of the following information:

average pixel value, interpupillary distance, deflection angle, etc.

S10: respectively obtaining a to-be-detected infrared image and ato-be-detected visible light image.

In one case, the to-be-detected infrared image and the to-be-detectedvisible light image are selected in the S13, it is equivalent to theto-be-detected infrared image and the to-be-detected visible light imageare obtained in this step. In this case, the completion of the above S13is equivalent to the completion of this step.

In another case, the selection of the to-be-detected infrared image andthe to-be-detected visible light image in S13 may be understood as thatselection of images, and the to-be-detected infrared image and theto-be-detected visible light image are not obtained or read. In thiscase, in this step, the to-be-detected infrared image and theto-be-detected visible light image may be obtained based on theselection result of S13.

S20: performing edge detection and texture feature extraction on theto-be-detected infrared image.

In one possible implementation, edge detection on the to-be-detectedinfrared image includes: filtering out noise in the to-be-detectedinfrared image through Gaussian transformation; performing, through aSobel operator, edge detection on the to-be-detected infrared image withnoise filtered out to obtain an edge detection result; and determininghistogram information of the edge detection result in differentdirections for the number of the edge pixel points, and filtering outnoise in the edge detection result according to the histograminformation. In this way, edge information of image regions of faces canbe obtained when the image regions of faces exist in the to-be-detectedinfrared image, and in this case, the edge information can be used asfeatures of the image region of the face, referred to as the facefeature.

When the to-be-detected infrared image is subjected to Gaussiantransformation, high-frequency information in the to-be-detectedinfrared image can be filtered out, and noise in the image is oftenexhibited as high-frequency information. Therefore, the noise in theto-be-detected infrared image can be filtered out after theto-be-detected infrared image is subjected to Gaussian transformation.

Of course, other transformation methods may also be used to filter noisein the to-be-detected infrared image, which is not limited in theembodiments of the present application.

When the edge detection is performed on the to-be-detected infraredimage after the noise is filtered through the sobel operator, edgeinformation of image content can be detected, and an edge image isobtained, which is referred to as the edge detection result here. Forexample, edge information of a face in an image is detected.

In addition, the above different directions may include a horizontaldirection and a vertical direction.

Specifically, when the histogram information of the edge detectionresult for the number of edge pixel points in different directions isdetermined, since the edge detection result is an edge image, the numberof edge pixel points included in each pixel row in the edge image can bedetermined as histogram statistical information, and/or the number ofedge pixel points included in each pixel column in the edge image can bedetermined as histogram statistical information.

Since the number of edge pixel points presented by the edge informationof the face in the image along the pixel rows or the pixel columns islarge, when the number of the edge pixel points represented by thehistogram information corresponding to pixel rows or pixel columns issmall, the probability that the edge pixel points in the pixel rows orpixel columns are not the edge pixel points of the face is high, andtherefore these pixel points can be filtered out from the above edgeimage.

In one possible implementation, the living body detection may be basedon static image texture. In this case, one or more features with motioninvariant properties, such as boundary lines or corner points in theimage, need to be extracted from the image, and a living body detectionmodel is created according to these features. And then it is detectedwhether the image is an image acquired for the living body through theliving body detection model.

Specifically, in the case that the above living body is a real face,when a real face detection is performed based on static image texture,the real face detection may be implemented based on a Local BinaryPattern (LBP), a Gabor wavelet, a Histogram of Oriented Gradients (HOG),and the like.

In one possible implementation, living body detection may be based ondynamic textures. In this case, when the above living body is a realface, the real face recognition can be performed by learning thestructure and dynamic information of the micro-texture of the real faceand performed by feature operator expansion in a spatial domain usingLBP.

In one possible implementation, extracting the texture features of theto-be-detected infrared image includes: extracting texture features ofthe to-be-detected infrared image through a Dynamic Local TernaryPattern (DLTP).

Specifically, the above DLTP is evolved from a Local Ternary Pattern(LTP). LTP is evolved from Local Binary Pattern (LBP).

The procedure of obtaining DLTP information based on LTP is brieflydescribed below.

Assuming that the pixel value of the current pixel point is g_(c), thegray values of P adjacent pixel points which are centered at the currentpixel point are g₁, g₂, . . . , g_(P) respectively.

First, g_(c)±τ is taken as a threshold, a binarization processing isperformed on the above adjacent pixel points.

Then, the pixel values of adjacent pixel points after the binarizationprocessing are weighted according to different positions of adjacentpixel points and a weighted sum is calculated, resulting in a localternary mode value of the current pixel point f_(LTP) _(P,R) (x_(c),y_(c), τ), namely,

${f_{{LTP}_{P,R}}\left( {x_{c},y_{c},\tau} \right)} = {\sum\limits_{i = 1}^{P}{2^{i - 1}{s\left( {g_{i} - g_{c}} \right)}}}$${s\left( {g_{i} - g_{c}} \right)} = \left\{ \begin{matrix}{1,} & {g_{i} \geq {g_{c} + \tau}} \\{0,} & {{g_{c} - \tau} < {g_{i} - g_{c}} < {g_{c} + \tau}} \\{{- 1},} & {g_{i} \leq {g_{c} - \tau}}\end{matrix} \right.$

wherein, the x_(c), y_(c) are horizontal and vertical coordinates of thecurrent pixel point in the image. s(g_(i)-g_(c)) represents the pixelvalue of the i-th adjacent pixel point after the binarizationprocessing.

When the local ternary mode is configured for extracting texturefeatures of images, the above value of τ is difficult to set. In anembodiment of the present application, the above τ can be determined byWeber's law, the expression of Weber's law is:

$\tau = {\frac{\;{\,_{\Delta}I}}{I} = \frac{{g_{c} - g_{i}}}{g_{c}}}$

Finally, the DLTP histogram obtained by the local ternary mode is:

${h_{j} = {\sum\limits_{x,y}{\delta\left\{ {{f_{{LTP}_{P,R}}\left( {x_{c},y_{c},\tau} \right)} - j} \right\}}}},{{j = 0};1^{P}},{{\delta(u)} = \left\{ \begin{matrix}{1,} & {u = 0} \\{0,} & {u \neq 0}\end{matrix} \right.}$

wherein, the x,y are horizontal and vertical coordinates of the pixelpoints in the image.

S30: performing feature extraction on the to-be-detected visible lightimage through a convolutional neural network.

The convolutional neural network is a network model which is often usedin deep learning. The network model has a multilayer structure, eachlayer performs feature extraction on input data of the layer, and theseextracted features are continuously input into the next layer in theform of a two-dimensional image.

In an embodiment of the present application, the size of each originalimage in the real face database may be used as the size of the inputimage of the above convolutional neural network when designing thestructure of the above convolutional neural network, in this way, theabove convolutional neural network may perform feature extraction on aninput image of one size, thereby reducing an excessive calculationamount of the convolutional neural network caused by the multi-scaleinput image.

The original image in the real face database can be used as a trainingsample to train the above convolutional neural network when the aboveconvolutional neural network is trained, so that the above convolutionalneural network learns the features of the real face in each originalimage in the real face database.

S40: determining whether the to-be-detected infrared image and theto-be-detected visible light image pass living body detection based on aresult of the edge detection on the to-be-detected infrared image, aresult of the texture feature extraction on the to-be-detected infraredimage, and a result of the feature extraction on the to-be-detectedvisible light image through the convolutional neural network.

In an embodiment of the application, feature fusion may be performed onthe result of edge detection on the to-be-detected infrared image, theresult of texture feature extraction, and the result of featureextraction on the to-be-detected visible light image through aconvolutional neural network, and then it is detected whether theto-be-detected infrared image and the to-be-detected visible light imagepass living body detection according to a result of the feature fusion.

Specifically, the feature fusion can be implemented through afull-connection layer of the network model.

The full-connection layer can include a plurality of nodes, and eachnode is configured for respectively obtaining the result of the edgedetection on the to-be-detected infrared image, the result of thetexture feature extraction on the infrared image, and the result of thefeature extraction on the to-be-detected visible light image through theconvolutional neural network. In this way, the full-connection layer canintegrate the features corresponding to the above three results.

A full-connection layer typically has the most parameters due to itsproperty of being fully connected. For example, in VGG16, the firstfull-connection layer FC1 has 4096 nodes and the upper pooling layerPOOL2 has 7*7*512=25088 nodes, then the above FC1 requires 4096*25088weight values, these weight values consume a large amount of memory.

In an embodiment of the present application, output results of thefull-connection layer can be classified through classifiers such assoftmax, and it can be determined whether the to-be-detected infraredimage and the to-be-detected visible light image pass living bodydetection. For example, the softmax classifier may determine inputinformation of the softmax classifier by setting a threshold, that is,determine an output result of the full-connection layer. When the inputinformation of the softmax classifier is greater than a presetthreshold, it is determined that the infrared image and the visibleimage to be detected are images for a real face and pass living bodydetection; otherwise, it is determined that the to-be-detected infraredimage and the to-be-detected visible light image are images for anunreal face and do not pass the living body detection.

Therefore, when the solution provided in this embodiment is applied toliving body detection, the to-be-detected infrared image and theto-be-detected visible light image can be respectively obtained, edgedetection and texture feature extraction are performed on theto-be-detected infrared image, and feature extraction is performed onthe to-be-detected visible light image through a convolutional neuralnetwork, and whether the to-be-detected infrared image and theto-be-detected visible light image pass living body detection isdetermined based on the result of edge detection on the to-be-detectedinfrared image, the result of the above texture feature extraction andthe result of feature extraction on the to-be-detected visible lightimage through the convolutional neural network. The process can combinethe advantages of three technologies of edge detection, texture featureextraction and convolution neural network, and can effectively performliving body detection. In the case that the to-be-detected infraredimage and the to-be-detected visible light image include the imageregions of a face, it can be efficiently determined whether the face inthe image is the face of a living body, and so as to improve thedetermination accuracy.

FIG. 3 shows another schematic flowchart of a method for living bodydetection based on face recognition according to the embodiments of thepresent application. The method may be performed by an electronicdevice, for example, a terminal device or a server device. In otherwords, the above method may be performed by software or hardwareinstalled in a terminal device or a server device. The above serverdevice includes but is not limited to: a single server, a servercluster, a cloud server or a cloud server cluster, etc. As shown in FIG.3, the method may include the following steps S11-S40.

S11: acquiring infrared images and visible light images using an imageacquisition component, and positioning faces in the infrared images andthe visible light images through a face detection algorithm.

In one possible implementation, this step includes: detecting faceregions in the infrared images and the visible light images through aface detection algorithm. In addition, after the above face regions aredetected, the number of infrared faces and the positions of face featurepoints in the infrared images can be determined, and the number ofvisible light faces and the positions of the face feature points in thevisible light image can be determined, on the basis of the detected faceregions. The above process realizes the positioning of the face in theinfrared image and the visible light image respectively.

S12: obtaining deflection angles and interpupillary distances of facesaccording to positions of the face feature points in the infrared imagesand positions of the face feature points in the visible images.

Specifically, in this step, deflection angles and interpupillarydistances of faces in the infrared images are obtained according topositions of face feature points in the infrared image, and deflectionangles and interpupillary distances of faces in the visible light imageare obtained according to positions of face feature points in thevisible light image.

In one embodiment of the present application, the distance between twoeyes of a human can be calculated according to the positions of featurepoints related to the eyes of the human, and then the interpupillarydistance of the face can be determined according to the above distance.

S13: selecting a to-be-detected infrared image and a to-be-detectedvisible light image from the infrared images and visible light imageswhich are acquired by the image acquisition component according toobtained deflection angles and interpupillary distances.

Face images with poor quality in the infrared images and the visiblelight images acquired by the image acquisition component can be filteredout according to the two parameters of the deflection angle and theinterpupillary distance, so as to improve the robustness of the livingbody detection.

S10: obtaining an to-be-detected infrared image and a to-be-detectedvisible light image.

S14: performing a grayscale pixel processing on the to-be-detectedinfrared image to obtain an infrared grayscale image.

In an embodiment of the application, grayscale transformation can beperformed on the to-be-detected infrared image to obtain a grayscaleimage corresponding to the to-be-detected infrared image, and thegrayscale image is used as an infrared grayscale image.

S15: normalizing the to-be-detected visible light image to obtain anormalized visible light image.

Normalization of an image refers to a process of transforming the imageinto a fixed standard image by performing a series of standardprocessing transformations. The standard image is called a normalizedimage.

S16: fusing the normalized visible light image and the infraredgrayscale image into a four-channel image.

Wherein, the above four-channel image includes: a red, green and blue(RGB) channel image and an infrared grayscale channel image.

The above RGB channel image includes: images corresponding to the threechannels of RGB respectively. The above infrared grayscale channel imageis: an infrared grayscale image corresponding to the 4th channel.

S20: performing edge detection and texture feature extraction on theto-be-detected infrared image.

In an embodiment of the present application, edge detection may beperformed on the infrared grayscale channel image, and texture featureextraction may be performed on the RGB channel image.

In one possible implementation, performing edge detection on theto-be-detected infrared image includes: filtering out noise in theto-be-detected infrared image through Gaussian transformation;performing, through a Sobel operator, edge detection on theto-be-detected infrared image with noise filtered out to obtain an edgedetection result; and determining histogram information of the edgedetection result in different directions for the number of the edgepixel points, and filtering out noise in the edge detection resultaccording to the histogram information. In this way, the edgeinformation of image regions of faces can be obtained, if any, from theto-be-detected infrared image. In this case, the edge information can beused as the features of image regions of faces, and the features arereferred to as the face feature.

In one possible implementation, the living body detection may be basedon static image texture. In this case, one or more features with motioninvariant properties, such as boundary lines or corner points in theimage, need to be extracted from the image, and a living body detectionmodel is created according to these features. And then detecting whetherthe image is an image acquired for the living body through the livingbody detection model.

Specifically, in the case that the above living body is a real face,when a real face detection is performed based on static image texture,the real face detection may be implemented based on LBP, Gabor wavelet,HOG, and the like.

In one possible implementation, living body detection may be based ondynamic textures. In this case, when the above living body is a realface, the real face recognition can be performed by learning thestructure and dynamic information of the micro-texture of the real faceand performed by feature operator expansion in a spatial domain usingLBP.

In one possible implementation, extracting the texture features of theto-be-detected infrared image includes: extracting texture features ofthe to-be-detected infrared image through a Dynamic Local TernaryPattern (DLTP).

Specifically, the above DLTP is evolved from a Local Ternary Pattern(LTP). LTP is evolved from Local Binary Pattern (LBP).

The procedure of obtaining DLTP information based on LTP is brieflydescribed below.

Assuming that the pixel value of the current pixel point is g_(c), thegray values of P adjacent pixel points which are centered at the currentpixel point are g₁, g₂, . . . , g_(P) respectively.

First, g_(c)±τ is taken as a threshold, a binarization processing isperformed on the above adjacent pixel points.

Then, the pixel values of adjacent pixel points after the binarizationprocessing are weighted according to different positions of adjacentpixel points and a weighted sum is calculated, resulting in a localternary mode value of the current pixel point f_(LTP) _(P,R)(x_(c)y_(c), τ), namely,

${f_{{LTP}_{P,R}}\left( {x_{c},y_{c},\tau} \right)} = {\sum\limits_{i = 1}^{P}{2^{i - 1}{s\left( {g_{i} - g_{c}} \right)}}}$${s\left( {g_{i} - g_{c}} \right)} = \left\{ \begin{matrix}{1,} & {g_{i} \geq {g_{c} + \tau}} \\{0,} & {{g_{c} - \tau} < {g_{i} - g_{c}} < {g_{c} + \tau}} \\{{- 1},} & {g_{i} \leq {g_{c} - \tau}}\end{matrix} \right.$

wherein, the x_(c), y_(c) are horizontal and vertical coordinates of thecurrent pixel point in the image. s(g_(i)-g_(c)) represents the pixelvalue of the ith adjacent pixel point after the binarization processing.

When the local ternary mode is configured for extracting the texturefeatures of the image, the above value of τ is difficult to set. In anembodiment of the present application, the above τ can be determined byWeber's law, the expression of Weber's law is:

$\tau = {\frac{\;{\,_{\Delta}I}}{I} = \frac{{g_{c} - g_{i}}}{g_{c}}}$

Finally, the DLTP histogram obtained by the local ternary mode is:

${h_{j} = {\sum\limits_{x,y}{\delta\left\{ {{f_{{LTP}_{P,R}}\left( {x_{c},y_{c},\tau} \right)} - j} \right\}}}},{{j = 0};1^{P}},{{\delta(u)} = \left\{ \begin{matrix}{1,} & {u = 0} \\{0,} & {u \neq 0}\end{matrix} \right.}$

wherein, the x,y are horizontal and vertical coordinates of the pixelpoints in the image.

S30: performing feature extraction on the to-be-detected visible lightimage through a convolutional neural network.

The convolutional neural network is a network model which is often usedin deep learning. The network model has a multilayer structure, eachlayer performs feature extraction on input data of the layer, and theseextracted features are continuously input into the next layer in theform of a two-dimensional image.

In a possible implementation, when the feature extraction is performedon the to-be-detected visible light image through the convolutionalneural network, the feature extraction may be performed on the abovefour-channel image through the convolutional neural network.

S40: determining whether the to-be-detected infrared image and theto-be-detected visible light image pass the living body detection basedon the result of edge detection on the to-be-detected infrared image,the result of extraction of the above texture features and the result offeature extraction on the to-be-detected visible light image through theconvolutional neural network.

Therefore, when the solution provided in this embodiment is applied toliving body detection, the to-be-detected infrared image and theto-be-detected visible light image can be respectively obtained, edgedetection and texture feature extraction are performed on theto-be-detected infrared image, and feature extraction is performed onthe to-be-detected visible light image through a convolutional neuralnetwork, and whether the to-be-detected infrared image and theto-be-detected visible light image pass living body detection isdetermined based on the result of edge detection on the to-be-detectedinfrared image, the result of the above texture feature extraction andthe result of the feature extraction on the to-be-detected visible lightimage through the convolutional neural network. The process can combinethe advantages of three technologies of edge detection, texture featureextraction and convolution neural network, and can effectively performliving body detection. In the case that the to-be-detected infraredimage and the to-be-detected visible light image include the imageregions of a face, it can be efficiently determined whether the face inthe image belongs to the face of living body, so as to improve thedetermination accuracy.

FIG. 4 shows a schematic structural diagram of an apparatus for livingbody detection based on face recognition according to the embodiments ofthe present application, the apparatus 100 includes: an obtaining module110, a processing module 120 and a determining module 130.

The obtaining module 110 is configured for a to-be-detected infraredimage and a to-be-detected visible light image respectively. Theprocessing module 120 is configured for performing edge detection andtexture feature extraction on the to-be-detected infrared image, andperforming feature extraction on the to-be-detected visible light imagethrough a convolutional neural network. The determining module 130 isconfigured for determining whether the to-be-detected infrared image andthe to-be-detected visible light image pass living body detection basedon a result of the edge detection on the to-be-detected infrared image,a result of the texture feature extraction on the to-be-detectedinfrared image, and a result of the feature extraction on theto-be-detected visible light image through the convolutional neuralnetwork.

In a possible implementation, the obtaining module 110 is specificallyconfigured for acquiring infrared images and visible light images usingan image acquisition component; and positioning faces in the infraredimages and the visible light images respectively through a facedetection algorithm; and obtaining a to-be-detected infrared image and ato-be-detected visible light image from the infrared images and thevisible light images according to results of face positioning in theinfrared images and the visible light images.

In a possible implementation, the obtaining module 110 is specificallyconfigured for detecting face regions in the infrared images and thevisible light images through a face detection algorithm; determiningpositions of face feature points in the infrared images; and determiningpositions of face feature points in the visible light images.

In a possible implementation, the obtaining module 110 is specificallyconfigured for obtaining deflection angles and interpupillary distancesof faces in the infrared images according to the positions of the facefeature points in the infrared images, and obtaining deflection anglesand interpupillary distances of faces in the visible light imagesaccording to the positions of the face feature points in the visiblelight images; and selecting, according to obtained deflection angles andinterpupillary distances, the to-be-detected infrared image and theto-be-detected visible light image from the infrared images and thevisible light images.

In a possible implementation, the obtaining module 110 is specificallyconfigured for acquiring infrared images and visible light images usingan image acquisition component; positioning a face in the infraredimages and the visible light images respectively through a facedetection algorithm; and obtaining an to-be-detected infrared image anda to-be-detected visible light image from the infrared images and thevisible light images respectively according to a result of positioningthe face in the infrared images and the visible light imagesrespectively.

In a possible implementation, the obtaining module 110 is specificallyconfigured for detecting face regions in the infrared images and thevisible light images through a face detection algorithm; determiningpositions of face feature points in the infrared images; and determiningpositions of face feature points in the visible light images.

In a possible implementation, the processing module 120 is furtherconfigured for performing grayscale pixel processing on theto-be-detected infrared image to obtain an infrared grayscale image;normalizing the to-be-detected visible light image to obtain anormalized visible light image; and fusing the normalized visible lightimage and the infrared grayscale image into a four-channel image,wherein the four-channel image comprises: a red, green and blue (RGB)channel image and an infrared grayscale channel image, wherein the RGBchannel image comprises: images corresponding to three channels of RGBrespectively, and the infrared grayscale channel image is: an infraredgrayscale image corresponding to the 4th channel.

In a possible implementation, the processing module 120 is specificallyconfigured for performing edge detection on the infrared grayscalechannel image, and performing texture feature extraction on the RGBchannel image; and performing feature extraction on the four-channelimage through a convolutional neural network.

In a possible implementation, the processing module 120 is specificallyconfigured for filtering out noise in the to-be-detected infrared imagethrough Gaussian transformation; performing, through a Sobel operator,edge detection on the to-be-detected infrared image with noise filteredout to obtain an edge detection result; and determining histograminformation of the edge detection result in different directions for thenumber of the edge pixel points, and filtering out noise in the edgedetection result according to the histogram information.

In a possible implementation, the processing module 120 is specificallyconfigured for extracting texture features of the to-be-detectedinfrared image through a dynamic local ternary mode.

FIG. 5 is a schematic structural diagram of an apparatus for living bodydetection based on face recognition according to an embodiment of thepresent application, the apparatus 100 includes: an obtaining module110, a processing module 120, a determining module 130 and a screeningmodule 140.

The screening module 140 is configured for obtaining deflection anglesand interpupillary distances of faces in the infrared images accordingto the positions of the face feature points in the infrared images, andobtaining deflection angles and interpupillary distances of faces in thevisible light images according to the positions of the face featurepoints in the visible light images; and selecting, according to obtaineddeflection angles and interpupillary distances, the to-be-detectedinfrared image and the to-be-detected visible light image from theinfrared images and the visible light images. The obtaining module 110is configured for obtaining an to-be-detected infrared image and ato-be-detected visible light image respectively. The processing module120 is configured for performing edge detection and texture featureextraction on the to-be-detected infrared image. The processing module120 is further configured for performing feature extraction on theto-be-detected visible light image through a convolutional neuralnetwork. The determining module 130 is configured for determiningwhether the to-be-detected infrared image and the to-be-detected visiblelight image pass living body detection based on a result of the edgedetection on the to-be-detected infrared image, a result of the texturefeature extraction on the to-be-detected infrared image, and a result ofthe feature extraction on the to-be-detected visible light image throughthe convolutional neural network.

The apparatus 100 provided in this embodiment of the present applicationmay perform the methods described in the foregoing method embodiments,and implement the functions and beneficial effects of the methodsdescribed in the foregoing method embodiments, which are not describedherein again.

FIG. 6 is a schematic hardware configuration diagram of an electronicdevice for executing the method for living body detection based on facerecognition according to an embodiment of the present application, andas shown in FIG. 6, the electronic device may vary with differentconfigurations or performances, and may include one or more processors701 and a memory 702. The memory 702 may store one or more applicationprograms or data. Memory 702 may be, among other things, transientstorage or persistent storage. The application programs stored in memory702 may include one or more modules (not shown), each of which mayinclude a series of computer-executable instructions for the electronicdevice. Furthermore, the processor 701 may be configured to communicatewith the memory 702, and execute on the electronic device a series ofcomputer-executable instructions in the memory 702. The electronicdevice may also include one or more power supplies 703, one or morewired or wireless network interfaces 704, one or more input-outputinterfaces 705, one or more keyboards 706, and the like.

In an embodiment of the present application, the electronic device shownin FIG. 6 may further include an image acquisition component.

In a specific embodiment, the electronic device includes an imageacquisition component for obtaining a to-be-detected infrared image anda to-be-detected visible light image respectively; performing edgedetection and texture feature extraction on the to-be-detected infraredimage; performing feature extraction on the to-be-detected visible lightimage through a convolutional neural network; and determining whetherthe to-be-detected infrared image and the to-be-detected visible lightimage pass living body detection based on a result of the edge detectionon the to-be-detected infrared image, a result of the texture featureextraction on the to-be-detected infrared image, and a result of thefeature extraction on the to-be-detected visible light image through theconvolutional neural network.

Therefore, the electronic device executing the method for living bodydetection based on face recognition according to the embodiments of thepresent application can execute the methods described in the foregoingmethod embodiments, and implement the functions and beneficial effectsof the methods described in the foregoing method embodiments, which arenot described herein again.

The electronic device of the embodiments of the present application isexisted in various forms, including but not limited to the followingdevices.

(1) Mobile communication devices, such devices are characterized bymobile communication functions and are primarily targeted at providingvoice and data communications. Such terminals include smart phones(e.g., iPhone), multimedia phones, functional phones, and low-endphones, etc.

(2) Ultra-mobile personal computer devices, such devices belong to thecategory of personal computers, have the functions of calculation andprocessing, and generally have the mobile internet access feature. Suchterminals include PDA, MID, and UMPC devices, such as iPad.

(3) Portable entertainment devices, such devices may display and playmultimedia content. Such devices include audio and video players (e.g.,iPod), handheld game consoles, e-books, and smart toys and portable carnavigation devices.

(4) Server, a device that provides computing services. The compositionof the server includes a processor, a hard disk, a memory, a system bus,etc. The server is similar to a general computer architecture, but hashigher requirements on processing capacity, stability, reliability,safety, expandability, manageability and the like due to the need ofproviding high-reliability service.

(5) Other electronic devices with data interaction functions.

Further, the embodiments of the present application also provide asystem for living body detection based on face recognition, comprising:an image acquisition component for acquiring infrared images and visiblelight images; an electronic device, comprising: a processor; and amemory configured to store computer executable instructions that, whenexecuted, cause the processor to perform the following operations:obtaining infrared images and visible light images acquired by the imageacquisition component, and selecting a to-be-detected infrared image anda to-be-detected visible light image; performing edge detection andtexture feature extraction on the to-be-detected infrared image;performing feature extraction on the to-be-detected visible light imagethrough a convolutional neural network; and determining whether theto-be-detected infrared image and the to-be-detected visible light imagepass living body detection based on a result of the edge detection onthe to-be-detected infrared image, a result of the texture featureextraction on the to-be-detected infrared image, and a result of thefeature extraction on the to-be-detected visible light image through theconvolutional neural network.

Therefore, the system for living body detection based on facerecognition, which is further provided by the embodiments of the presentapplication, can perform the methods described in the foregoing methodembodiments, and implement the functions and beneficial effects of themethods described in the foregoing method embodiments, which are notdescribed herein again.

Further, the embodiments of the present application also provides acomputer-readable storage medium for storing computer-executableinstructions, the computer-executable instructions, when executed by aprocessor, implement the following operations: obtaining ato-be-detected infrared image and a to-be-detected visible light imagerespectively; performing edge detection and texture feature extractionon the to-be-detected infrared image; performing feature extraction onthe to-be-detected visible light image through a convolutional neuralnetwork; and determining whether the to-be-detected infrared image andthe to-be-detected visible light image pass living body detection basedon a result of the edge detection on the to-be-detected infrared image,a result of the texture feature extraction on the to-be-detectedinfrared image, and a result of the feature extraction on theto-be-detected visible light image through the convolutional neuralnetwork.

Therefore, when executed by a processor, the computer-executableinstructions are capable of performing the methods described in theforegoing method embodiments, and implementing the functions andbeneficial effects of the methods described in the foregoing methodembodiments, which are not described herein again.

The computer-readable storage medium includes a Read-Only Memory (ROM),a Random Access Memory (RAM), a magnetic disk or an optical disk.

Further, the embodiments of the present application also provide acomputer program product, the computer program product includes acomputer program stored on a non-transitory computer readable storagemedium, the computer program includes program instructions that, whenexecuted by a computer, implement the following processes: obtaining ato-be-detected infrared image and a to-be-detected visible light imagerespectively; performing edge detection and texture feature extractionon the to-be-detected infrared image; performing feature extraction onthe to-be-detected visible light image through a convolutional neuralnetwork; and determining whether the to-be-detected infrared image andthe to-be-detected visible light image pass living body detection basedon a result of the edge detection on the to-be-detected infrared image,a result of the texture feature extraction on the to-be-detectedinfrared image, and a result of the feature extraction on theto-be-detected visible light image through the convolutional neuralnetwork.

Therefore, when the computer program product provided in the embodimentsof the present application is executed, the methods described in theforegoing method embodiments can be executed, and functions andbeneficial effects of the methods described in the foregoing methodembodiments are implemented, which are not described herein again.

All the embodiments in the present specification are described in aprogressive manner, and the same and similar parts among the embodimentsare referred to each other, and each embodiment focuses on thedifferences from other embodiments. In particular, for the apparatus,the electronic device, the computer-readable medium, the computerprogram product, and the system embodiments, since they aresubstantially similar to the method embodiments, the description isrelatively simple, and in relation to the method embodiments, referencemay be made to the partial description of the method embodiments.

The above description is only an example of the present application andis not intended to limit the present application. Various modificationsand changes for the present application may occur to those skilled inthe art. Any modification, equivalent replacement, improvement or thelike made within the spirit and principle of the present applicationshall be included in the scope of the claims of the present application.

What is claimed is:
 1. A method for living body detection based on facerecognition, comprising: obtaining a to-be-detected infrared image and ato-be-detected visible light image respectively; performing edgedetection and texture feature extraction on the to-be-detected infraredimage; performing feature extraction on the to-be-detected visible lightimage through a convolutional neural network; and determining whetherthe to-be-detected infrared image and the to-be-detected visible lightimage pass living body detection based on a result of the edge detectionon the to-be-detected infrared image, a result of the texture featureextraction on the to-be-detected infrared image, and a result of thefeature extraction on the to-be-detected visible light image through theconvolutional neural network.
 2. The method of claim 1, before theobtaining the to-be-detected infrared image and the to-be-detectedvisible light image respectively, the method further comprises:acquiring infrared images and visible light images using an imageacquisition component; and positioning faces in the infrared images andthe visible light images respectively through a face detectionalgorithm; wherein obtaining a to-be-detected infrared image and ato-be-detected visible light image respectively comprises: obtaining ato-be-detected infrared image and a to-be-detected visible light imagefrom the infrared images and the visible light images respectivelyaccording to results of face positioning in the infrared images and thevisible light images.
 3. The method of claim 2, wherein positioningfaces in the infrared images and the visible light images respectivelythrough a face detection algorithm comprises: detecting face regions inthe infrared images and the visible light images through a facedetection algorithm; determining positions of face feature points in theinfrared images; and determining positions of face feature points in thevisible light images.
 4. The method of claim 3, wherein obtaining ato-be-detected infrared image and a to-be-detected visible light imagefrom the infrared images and the visible light images respectivelyaccording to results of face positioning in the infrared images and thevisible light images comprises: obtaining deflection angles andinterpupillary distances of faces in the infrared images according tothe positions of the face feature points in the infrared images, andobtaining deflection angles and interpupillary distances of faces in thevisible light images according to the positions of the face featurepoints in the visible light images; and selecting, according to obtaineddeflection angles and interpupillary distances, the to-be-detectedinfrared image and the to-be-detected visible light image from theinfrared images and the visible light images.
 5. The method of claim 1,after the obtaining the to-be-detected infrared image and theto-be-detected visible light image respectively, the method furthercomprises: performing grayscale pixel processing on the to-be-detectedinfrared image to obtain an infrared grayscale image; normalizing theto-be-detected visible light image to obtain a normalized visible lightimage; and fusing the normalized visible light image and the infraredgrayscale image into a four-channel image, wherein the four-channelimage comprises: a red, green and blue (RGB) channel image and aninfrared grayscale channel image, wherein the RGB channel imagecomprises: images corresponding to three channels of RGB respectively,and the infrared grayscale channel image is: an infrared grayscale imagecorresponding to the 4th channel.
 6. The method of claim 5, whereinperforming edge detection and texture feature extraction on theto-be-detected infrared image comprises: performing edge detection onthe infrared grayscale channel image, and performing texture featureextraction on the RGB channel image; wherein performing featureextraction on the to-be-detected visible light image through aconvolutional neural network comprises: performing feature extraction onthe four-channel image through a convolutional neural network.
 7. Themethod of claim 1, wherein performing edge detection on theto-be-detected infrared image comprises: filtering out noise in theto-be-detected infrared image through Gaussian transformation;performing, through a Sobel operator, edge detection on theto-be-detected infrared image with noise filtered out to obtain an edgedetection result; and determining histogram information of the edgedetection result in different directions for the number of the edgepixel points, and filtering out noise in the edge detection resultaccording to the histogram information.
 8. The method of claim 1,wherein performing texture feature extraction on the to-be-detectedinfrared image comprises: extracting texture features of theto-be-detected infrared image through a dynamic local ternary mode. 9.An electronic device, comprising: an image acquisition component forobtaining a to-be-detected infrared image and a to-be-detected visiblelight image respectively; a processor; and a memory configured to storecomputer executable instructions that, when executed, use the processorto perform the following operations: performing edge detection andtexture feature extraction on the to-be-detected infrared image;performing feature extraction on the to-be-detected visible light imagethrough a convolutional neural network; and determining whether theto-be-detected infrared image and the to-be-detected visible light imagepass living body detection based on a result of the edge detection onthe to-be-detected infrared image, a result of the texture featureextraction on the to-be-detected infrared image, and a result of thefeature extraction on the to-be-detected visible light image through theconvolutional neural network.
 10. The electronic device of claim 9,before obtaining the to-be-detected infrared image and theto-be-detected visible light image respectively, the electronic deviceis further configured for: acquiring infrared images and visible lightimages using an image acquisition component; and positioning faces inthe infrared images and the visible light images respectively through aface detection algorithm; wherein, obtaining a to-be-detected infraredimage and a to-be-detected visible light image respectively comprises:obtaining a to-be-detected infrared image and a to-be-detected visiblelight image from the infrared images and the visible light imagesrespectively according to results of face positioning in the infraredimages and the visible light images.
 11. The electronic device of claim10, wherein positioning faces in the infrared images and the visiblelight images respectively through the face detection algorithmcomprises: detecting face regions in the infrared images and the visiblelight images through a face detection algorithm; determining positionsof face feature points in the infrared images; and determining positionsof face feature points in the visible light images.
 12. The electronicdevice of claim 11, wherein obtaining a to-be-detected infrared imageand a to-be-detected visible light image from the infrared images andthe visible light images respectively according to results of facepositioning in the infrared images and the visible light imagescomprises: obtaining deflection angles and interpupillary distances offaces in the infrared images according to the positions of the facefeature points in the infrared images, and obtaining deflection anglesand interpupillary distances of faces in the visible light imagesaccording to the positions of the face feature points in the visiblelight images; and selecting, according to obtained deflection angles andinterpupillary distances, the to-be-detected infrared image and theto-be-detected visible light image from the infrared images and thevisible light images.
 13. The electronic device of claim 9, after theobtaining the to-be-detected infrared image and the to-be-detectedvisible light image respectively, the electronic device is furtherconfigured for: performing grayscale pixel processing on theto-be-detected infrared image to obtain an infrared grayscale image;normalizing the to-be-detected visible light image to obtain anormalized visible light image; and fusing the normalized visible lightimage and the infrared grayscale image into a four-channel image,wherein the four-channel image comprises: a red, green and blue (RGB)channel image and an infrared grayscale channel image, wherein the RGBchannel image comprises: images corresponding to three channels of RGBrespectively, and the infrared grayscale channel image is: an infraredgrayscale image corresponding to the 4th channel.
 14. The electronicdevice of claim 13, wherein performing edge detection and texturefeature extraction on the to-be-detected infrared image comprises:performing edge detection on the infrared grayscale channel image, andperforming texture feature extraction on the RGB channel image; whereinperforming feature extraction on the to-be-detected visible light imagethrough a convolutional neural network comprises: performing featureextraction on the four-channel image through a convolutional neuralnetwork.
 15. The electronic device of claim 9, wherein performing edgedetection on the to-be-detected infrared image comprises: filtering outnoise in the to-be-detected infrared image through Gaussiantransformation; performing, through a Sobel operator, edge detection onthe to-be-detected infrared image with noise filtered out to obtain anedge detection result; and determining histogram information of the edgedetection result in different directions for the number of the edgepixel points, and filtering out noise in the edge detection resultaccording to the histogram information.
 16. The electronic device ofclaim 9, wherein performing texture feature extraction on theto-be-detected infrared image comprises: extracting texture features ofthe to-be-detected infrared image through a dynamic local ternary mode.17. A non-transitory computer readable medium storing one or moreprograms that, when executed by an electronic device, cause theelectronic device to perform the method of claim
 1. 18. A system forliving body detection based on face recognition, comprising: an imageacquisition component for acquiring infrared images and visible lightimages; an electronic device, comprising: a processor; and a memoryconfigured to store computer executable instructions that, whenexecuted, cause the processor to perform the following operations:obtaining infrared images and visible light images acquired by the imageacquisition component, and selecting a to-be-detected infrared image anda to-be-detected visible light image; performing edge detection andtexture feature extraction on the to-be-detected infrared image;performing feature extraction on the to-be-detected visible light imagethrough a convolutional neural network; and determining whether theto-be-detected infrared image and the to-be-detected visible light imagepass living body detection based on a result of the edge detection onthe to-be-detected infrared image, a result of the texture featureextraction on the to-be-detected infrared image, and a result of thefeature extraction on the to-be-detected visible light image through theconvolutional neural network. 19-26. (canceled)